package demo2;

import java.lang.management.MemoryNotificationInfo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 19182
 * Date: 2025-07-15
 * Time: 21:47
 */
public class Person implements Cloneable{
    public String name;
    public int age;
    public Money money;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp = (Person)super.clone();
        tmp.money = (Money)this.money.clone();
        return tmp;
    }

    public static void main(String[] args) throws CloneNotSupportedException{
        Person person1 = new Person("张三", 20);
        Person person2 = (Person)person1.clone();

    }
}
